<html>
<head><meta charset="utf-8"><title>intrinsic-promotion · t-compiler/const-eval · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/index.html">t-compiler/const-eval</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html">intrinsic-promotion</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="167208755"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/167208755" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#167208755">(Jun 03 2019 at 16:45)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span>  there's now <a href="https://github.com/rust-lang/rust/pull/61493" target="_blank" title="https://github.com/rust-lang/rust/pull/61493">https://github.com/rust-lang/rust/pull/61493</a></p>



<a name="168287420"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/168287420" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vertexclique <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#168287420">(Jun 17 2019 at 07:02)</a>:</h4>
<p>Fyi, I will rebase my pr today and address things that you've commented over. <a href="https://github.com/rust-lang/rust/pull/61835" target="_blank" title="https://github.com/rust-lang/rust/pull/61835">https://github.com/rust-lang/rust/pull/61835</a></p>



<a name="174348601"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/174348601" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vertexclique <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#174348601">(Aug 28 2019 at 10:06)</a>:</h4>
<p>Hi all, I will get back to this PR asap. (if there is no problem blocking it)</p>



<a name="174351133"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/174351133" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#174351133">(Aug 28 2019 at 10:54)</a>:</h4>
<p>cool</p>



<a name="174351137"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/174351137" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#174351137">(Aug 28 2019 at 10:54)</a>:</h4>
<p>note that a bunch of stuff changed in the background and is changing (there are a few open PRs)</p>



<a name="174351151"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/174351151" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#174351151">(Aug 28 2019 at 10:55)</a>:</h4>
<p>so doing it in the smallest possible steps would be good to not cause much churn</p>



<a name="174859127"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/174859127" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vertexclique <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#174859127">(Sep 04 2019 at 07:51)</a>:</h4>
<p>Can somebody explain to me about "promotion" and "evaluability" in this context? If I understand correctly, promotion is enabling/disabling evaluability for specific function(in this context's case some instrinsics) in <code>const</code> context when <code>const</code> declaration happens. Is it correct? What is more correct? I am lost in terms.</p>



<a name="174864296"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/174864296" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#174864296">(Sep 04 2019 at 09:12)</a>:</h4>
<p>Promotion is generating an unnameable static from runtime code</p>



<a name="174864333"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/174864333" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#174864333">(Sep 04 2019 at 09:13)</a>:</h4>
<p>Evaluability is whether some piece of code can be processed by const eval</p>



<a name="174864345"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/174864345" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#174864345">(Sep 04 2019 at 09:13)</a>:</h4>
<p>Promotion requires evaluability but is much stronger</p>



<a name="174864367"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/174864367" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#174864367">(Sep 04 2019 at 09:13)</a>:</h4>
<p>Intrinsics should never be promotable, but can be evaluable</p>



<a name="175747609"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/175747609" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#175747609">(Sep 15 2019 at 12:52)</a>:</h4>
<p><span class="user-mention" data-user-id="223879">@vertexclique</span> also see <a href="https://github.com/rust-rfcs/const-eval/" target="_blank" title="https://github.com/rust-rfcs/const-eval/">https://github.com/rust-rfcs/const-eval/</a></p>



<a name="175747610"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/175747610" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#175747610">(Sep 15 2019 at 12:52)</a>:</h4>
<p>but the documents there are still being worked on</p>



<a name="175747618"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/175747618" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#175747618">(Sep 15 2019 at 12:53)</a>:</h4>
<p>in particular we are <a href="https://github.com/rust-rfcs/const-eval/pull/27#issuecomment-526082204" target="_blank" title="https://github.com/rust-rfcs/const-eval/pull/27#issuecomment-526082204">looking for some terminology</a></p>



<a name="175747620"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/175747620" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#175747620">(Sep 15 2019 at 12:53)</a>:</h4>
<p>and I got no feedback at all on that my proposal there :/<br>
<span class="user-mention" data-user-id="124288">@oli</span> <span class="user-mention" data-user-id="119009">@eddyb</span> any comments?</p>



<a name="176348808"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176348808" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vertexclique <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176348808">(Sep 23 2019 at 08:22)</a>:</h4>
<p>I think I need to take a look at this change and refactor things again?<br>
<a href="https://github.com/rust-lang/rust/pull/64683" target="_blank" title="https://github.com/rust-lang/rust/pull/64683">https://github.com/rust-lang/rust/pull/64683</a></p>



<a name="176348833"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176348833" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vertexclique <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176348833">(Sep 23 2019 at 08:22)</a>:</h4>
<p>Should I wait for the merge or rebase later?</p>



<a name="176441476"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176441476" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176441476">(Sep 24 2019 at 08:11)</a>:</h4>
<p>That PR is blocked on your changes, so... :D</p>



<a name="176443568"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176443568" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vertexclique <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176443568">(Sep 24 2019 at 08:46)</a>:</h4>
<p>OOF my bad. <span aria-label="face palm" class="emoji emoji-1f926" role="img" title="face palm">:face_palm:</span></p>



<a name="176450819"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176450819" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vertexclique <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176450819">(Sep 24 2019 at 10:32)</a>:</h4>
<p>I have reopened the PR. Solved conflicts.</p>



<a name="176450857"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176450857" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vertexclique <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176450857">(Sep 24 2019 at 10:33)</a>:</h4>
<p>Last time const_transmute feature gate was ignored at the caller site.</p>



<a name="176450905"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176450905" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vertexclique <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176450905">(Sep 24 2019 at 10:34)</a>:</h4>
<p>I don't know how to fix that rn. I am adding the tests.</p>



<a name="176469741"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176469741" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vertexclique <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176469741">(Sep 24 2019 at 14:37)</a>:</h4>
<p>I am at work btw. Will look at your comments <span class="user-mention" data-user-id="124288">@oli</span></p>



<a name="176470655"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176470655" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176470655">(Sep 24 2019 at 14:46)</a>:</h4>
<p>no pressure. That's what we have github for, async communication</p>



<a name="176824400"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176824400" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vertexclique <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176824400">(Sep 28 2019 at 12:29)</a>:</h4>
<p>I have a problem with <code>const_transmute</code>. I have removed that feature from active. Should I move it to removed? How I can disable it because</p>
<div class="codehilite"><pre><span></span>#[rustc_const_unstable(feature = &quot;const_transmute&quot;)]
</pre></div>


<p>is creating problem on compilation and makes const_transmute tests fail.<br>
Long story short  I want to reenable const_transmute gate that we had disabled before.</p>



<a name="176824402"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176824402" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vertexclique <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176824402">(Sep 28 2019 at 12:29)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> any idea on this?</p>



<a name="176824453"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176824453" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176824453">(Sep 28 2019 at 12:30)</a>:</h4>
<p>you should remove it entirely I think? The <code>rustc_const_unstable</code> will generate its own feature gate names</p>



<a name="176824462"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176824462" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176824462">(Sep 28 2019 at 12:31)</a>:</h4>
<blockquote>
<p>is creating problem on compilation and makes const_transmute tests fail.</p>
</blockquote>
<p>Do you have the errors at hand?</p>



<a name="176824468"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176824468" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vertexclique <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176824468">(Sep 28 2019 at 12:31)</a>:</h4>
<p>recompiling now I will write here.</p>



<a name="176825246"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176825246" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vertexclique <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176825246">(Sep 28 2019 at 12:55)</a>:</h4>
<div class="codehilite"><pre><span></span>thread &#39;rustc&#39; panicked at &#39;assertion failed: !self.tcx.is_const_fn(def_id)&#39;, src/librustc_mir/transform/qualify_consts.rs:1286:29
stack backtrace:
</pre></div>


<p><span class="user-mention" data-user-id="124288">@oli</span></p>



<a name="176825317"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176825317" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vertexclique <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176825317">(Sep 28 2019 at 12:57)</a>:</h4>
<p>this is caused by early return to not check that const fn for intrinsics</p>



<a name="176825490"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176825490" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176825490">(Sep 28 2019 at 13:02)</a>:</h4>
<p>oh, just swap the condition</p>



<a name="176825500"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176825500" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176825500">(Sep 28 2019 at 13:02)</a>:</h4>
<p>we want to check now that the intrinsic is "const fn"</p>



<a name="176827782"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176827782" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vertexclique <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176827782">(Sep 28 2019 at 14:15)</a>:</h4>
<p>transmute tests are getting compiled. sigh</p>



<a name="176827826"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176827826" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vertexclique <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176827826">(Sep 28 2019 at 14:16)</a>:</h4>
<p>Also changed my local test to what <span class="user-mention" data-user-id="120791">@RalfJ</span> commented.</p>



<a name="176827894"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176827894" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176827894">(Sep 28 2019 at 14:18)</a>:</h4>
<p>uh</p>



<a name="176827896"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176827896" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176827896">(Sep 28 2019 at 14:18)</a>:</h4>
<p>sorry</p>



<a name="176827897"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176827897" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176827897">(Sep 28 2019 at 14:18)</a>:</h4>
<p>I should have been clearer</p>



<a name="176827899"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176827899" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176827899">(Sep 28 2019 at 14:18)</a>:</h4>
<p>swap the assert!</p>



<a name="176827907"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176827907" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176827907">(Sep 28 2019 at 14:19)</a>:</h4>
<p>I want the assert to trigger if we call an intrinsic that is not in the list</p>



<a name="176829116"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176829116" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vertexclique <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176829116">(Sep 28 2019 at 14:55)</a>:</h4>
<p>I've negated the assert before but it gives ice.</p>



<a name="176829164"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176829164" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vertexclique <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176829164">(Sep 28 2019 at 14:56)</a>:</h4>
<p>I've tried again. It gave ice again. Seems like there is a usage for both transmute and other intrinsics in the codebase.</p>



<a name="176829174"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176829174" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176829174">(Sep 28 2019 at 14:57)</a>:</h4>
<p>you can print more info on the assert</p>



<a name="176829179"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176829179" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176829179">(Sep 28 2019 at 14:57)</a>:</h4>
<p>e.g. <code>tcx.item_name(def_id)</code> or so</p>



<a name="176829225"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176829225" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176829225">(Sep 28 2019 at 14:58)</a>:</h4>
<p><code>assert!(condition, "{}", tcx.item_name(def_id))</code></p>



<a name="176829227"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176829227" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vertexclique <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176829227">(Sep 28 2019 at 14:58)</a>:</h4>
<p>oh ok so we expect it. _gets enlightened_</p>



<a name="176829228"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176829228" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176829228">(Sep 28 2019 at 14:58)</a>:</h4>
<p>this way you see which intrinsic it is and can add it to the list</p>



<a name="176829234"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176829234" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vertexclique <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176829234">(Sep 28 2019 at 14:59)</a>:</h4>
<p>ok thanks let me check.</p>



<a name="176829239"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176829239" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176829239">(Sep 28 2019 at 14:59)</a>:</h4>
<p>we want <code>is_const_fn</code> to return true for whitelisted intrinsics, so the assert should trigger, but I don't know why it's triggering for you</p>



<a name="176829688"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176829688" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vertexclique <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176829688">(Sep 28 2019 at 15:12)</a>:</h4>
<p>It is <code>mem::size_of </code> but it is in platform intrinsics list.</p>



<a name="176829814"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176829814" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176829814">(Sep 28 2019 at 15:16)</a>:</h4>
<p>huh?</p>



<a name="176829822"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176829822" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176829822">(Sep 28 2019 at 15:16)</a>:</h4>
<p>it should be a normal intrinsic</p>



<a name="176829830"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176829830" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176829830">(Sep 28 2019 at 15:17)</a>:</h4>
<p>can you push the full code so I can have a look?</p>



<a name="176829839"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176829839" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vertexclique <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176829839">(Sep 28 2019 at 15:17)</a>:</h4>
<p>recompiling now I got you wrong when you said swap the condition. I negated the <code>is_const_intrinsic</code>, you already have commented on that.</p>



<a name="176829845"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176829845" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vertexclique <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176829845">(Sep 28 2019 at 15:17)</a>:</h4>
<p>yes in a sec.</p>



<a name="176831103"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176831103" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vertexclique <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176831103">(Sep 28 2019 at 15:55)</a>:</h4>
<p>pushed. btw even match arm has RustIntrinsic pattern I got: <code>intrinsic 'maxnumf32' is not in whitelist</code>.</p>



<a name="176831442"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176831442" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vertexclique <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176831442">(Sep 28 2019 at 16:06)</a>:</h4>
<p>+ maxnumf32/f64 and more aren't in const intrinsics whitelist</p>



<a name="176839546"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/176839546" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vertexclique <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#176839546">(Sep 28 2019 at 20:06)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> I might have interpreted you wrong again. scratching my head here.</p>



<a name="177461057"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion/near/177461057" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vertexclique <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/intrinsic-promotion.html#177461057">(Oct 06 2019 at 13:16)</a>:</h4>
<p>had no time to debug what is happening in the branch.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>